<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/5/20
  Time: 15:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="path" value="${pageContext.request.contextPath}"></c:set>
<link rel="icon" href="${path}/LeisureSeeker/icons/favicon.ico" sizes="16x16"/>
<html>
<head>
    <meta name="viewport"
          content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="baidu-tc-cerfication" content="8f75aa1d017086290b42263df41c1791"/>
    <meta name="keywords" content="自助游,舒客,旅居网"/>
    <meta name="description" content="舒客旅游网 Yododo"/>
    <meta name="apple-mobile-web-app-title" content="0"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <title>个人中心</title>
    <link rel="stylesheet" href="${path}/LeisureSeeker/css/jquery-ui-1.9.custom.css">
    <link rel="stylesheet" href="${path}/LeisureSeeker/css/ylj.css">
    <script type="text/javascript" charset="utf-8" src="${path}/LeisureSeeker/js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="${path}/LeisureSeeker/js/jquery-ui-1.9.2.min.js"></script>
    <script type="text/javascript"> var $j = jQuery.noConflict(); </script>
    <script type="text/javascript" charset="utf-8" src="${path}/LeisureSeeker/js/yododo.js"></script>
    <script type="text/javascript" charset="utf-8" src="${path}/LeisureSeeker/js/prototype.js"></script>
    <c:set var="path" value="${pageContext.request.contextPath}"></c:set>
    <link rel="icon" href="${path}/LeisureSeeker/icons/favicon.ico" sizes="16x16"/>
</head>
<body>
<jsp:include page="header.jsp"/>
<div class="usersp-main">
    <div class="usersp-hd">
        <div class="w1200">
            <div class="usersp-z clearfix">
                <strong>${sessionScope.userInfo.userName!=null?sessionScope.userInfo.userName:sessionScope.userInfo.tel}<i>的个人空间</i>
                    <span>推荐</span></strong>
                <%--<p>--%>
                <%--<span>男</span>--%>
                <%--<span><i>积分</i>283664</span>--%>
                <%--<span><i>现住</i>--%>
                <%--北京--%>
                <%--</span>--%>
                <%--<span><i>注册于</i>2010-01-23</span>--%>
                <%--</p>--%>
                <%--<p class="ft16">一个退休的倔老头，喜欢自由行。</p>--%>
            </div>
            <div class="usersp-t clearfix">
                <a class="current" href="${path}/usercenterapi/userCenter">TA的攻略</a>
                <a href="${path}/usercenterapi/userInfo">个人信息</a>
                <a href="${path}/usercenterapi/userStrategy">发布攻略</a>
                <a href="${path}/usercenterapi/userCollection">TA的收藏</a>
            </div>
        </div>
    </div>

    <div class="w1200">
        <div class="usersp-lb">

        </div>
        <div class="userglist" style="border-bottom: 1px dashed #fff;">
            <ul class="clearfix" id="travels">
                <!--  <li>
                        <a href="${path}/usercenterapi/userDetails" target="_blank">
                            <div class="ugimg" style="background-image: url(http://img0.yododo.com.cn/files/photo/2019-04-07/0169F7058FAC211FF2D0D07569F45B1F.jpg)">&nbsp;</div>
                            <strong>再去云南D15【原创-摄影】</strong>
                            <p><span class="partialDisplay">再去云南D15【原创-摄影】D15 3.20 周三 晴 黑龙潭6:40起床，7:10早饭。7:45出发，由老伴的妹妹陪同，先坐地铁3号线五一路站到东风广场站下，换乘2号线到龙头街站，再换乘公交车79路到黑龙潭站，于8:50到黑龙潭。去黑龙潭主要目标是拍小翠，为此老伴的妹妹特意询问了她的摄友。我们先在进门左侧拍小翠水域等了半个小时，未果，则上山到定风塔，在附近一个拍摄点拍了2个小时，拍到8种鸟。应该说收获挺大的（鸟片另发）。黑龙潭景色...</span></p>
                            <span><img src="images/01265A1A5AB4076FFF8080812659A2F5.jpg">wmy701</span>
                            <i>2019年05月<strong>云南 昆明 </strong></i>
                        </a>
                    </li>-->

            </ul>
        </div>
    </div>
</div>
<jsp:include page="bottom.jsp"/>
<script type="text/javascript" charset="utf-8" src="${path}/LeisureSeeker/js/yododo.js"></script>
<script>
    $(function () {
        $.ajax({
            'url': '${path}/traapi/travelsById/' + ${userInfo.userId},
            'type': 'get',
            success: function (data) {



                for (var i = 0; i < data.length; i++) {
                    //将时间戳转为指定格式
                    var traid = data[i].traId;
                    var time = new Date(data[i].traDate);
                    var dateTime = time.getFullYear() + "年" + (time.getMonth() + 1) + "月" + time.getDate() + "日";
                    //定义一个pic值为用户上传的图片路径
                    var pic = data[i].traPicpath;
                    var trapic;
                    //判断 如果路径包含了, 就表示用户上传了多张图片，用split将路径转为数组，取第一个图片的路径赋值给trapic
                    //否则 用户只上传了一张图片，直接将控制器传过来的traPicpath作为trapic的值
                    if (pic.indexOf(",") != -1) {
                        trapic = pic.split(',')[0];
                    } else {
                        trapic = data[i].traPicpath;
                    }


                    //追加元素 即页面上展示的攻略相关信息
                    $("#travels").append("<li> <a href=${path}/traapi/travels/" + traid + " target='_blank'>" +
                        "<div class='ugimg' style='background-image: url(" + trapic + ")'>"
                        + "&nbsp;</div>"
                        + " <strong>" + data[i].traTitle + "</strong>"
                        + "<p><span class='partialDisplay'>" + data[i].traContent + "</span></p>"
                        + " <i>" + dateTime + "<strong> </strong></i> </a> </li>"
                    );

                }
            }
        });
    });


</script>
</body>
</html>
